package com.tb;

import java.util.List;
import java.util.Map;

/**
 * comment
 *
 * @author zhao yuan
 * @since 2018/3/7
 */
public class JdAppPriceTable {

    /**
     * 价目表， 单位：分
     * 一维：version
     * 二维：周期
     */
    private int[][] priceTable;

    List<String> versions;

    /**
     * key:versionName
     * value: versionId
     */
    Map<String,String> versionMap;

    List<String> periodNames;

    public int calcPrice(String versionName, String period){
        String versionId = versionMap.get(versionName);
        int i = versions.indexOf(versionId);
        int j = periodNames.indexOf(period);
        if(j < 0) j=0;
        return priceTable[i][j];
    }


    public int[][] getPriceTable() {
        return priceTable;
    }

    public void setPriceTable(int[][] priceTable) {
        this.priceTable = priceTable;
    }

    public List<String> getVersions() {
        return versions;
    }

    public void setVersions(List<String> versions) {
        this.versions = versions;
    }

    public Map<String, String> getVersionMap() {
        return versionMap;
    }

    public void setVersionMap(Map<String, String> versionMap) {
        this.versionMap = versionMap;
    }

    public List<String> getPeriodNames() {
        return periodNames;
    }

    public void setPeriodNames(List<String> periodNames) {
        this.periodNames = periodNames;
    }
}
